package cn.rui.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * 会员实体类
 * @author 徽州大都督
 * @date 2020/8/15
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("user")
public class User implements Serializable {

    @TableId(type = IdType.AUTO)
    private Integer uid;

    private String username;
    private String password;
    private Integer sex;
    @TableField(exist = false)
    private String sexStr;
    private String telephone;
    private String email;
    private String address;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    private Long integral; //积分
    @TableField(exist = false)
    private String level; //等级
    private Integer status;
    @TableLogic
    private Integer deleted;

    private String name;

    private String salt;

    private Double money;

    @TableField(exist = false)
    private Long total;



    public String getLevel() {


            if (integral>=0&&integral<1000){
                return "普通用户";
            }else if (integral>=1000&&integral<3000){
                return "银牌用户";
            }else if (integral>=3000&&integral<8000){
                return "金牌用户";
            }else if (integral>=8000&&integral<15000){
                return "钻石用户";
            }else {
                return "黑金用户";
            }


    }

}
